package com.asohofrucol.web;

import javax.faces.event.ActionEvent;

import org.springframework.beans.factory.annotation.Autowired;

import com.asohofrucol.dto.AsohofrucolSessionDTO;
import com.asohofrucol.dto.AssociativityRegisterDTO;

/**
 * 
 * @author iván Esta clase maneja la interfaz para conformar los datos de
 *         asociatividad
 */
public class AssociativityController {
	@Autowired
	private AsohofrucolSessionDTO aSession;

	public void createNewRegister(ActionEvent actionEvent) {
		if((aSession.getAssociativity().getAssociativityRegisters().size()<3)){
			Long ruatId = aSession.getSelectedRuatRegister().getId();
			AssociativityRegisterDTO associativityRegisterDTO = new AssociativityRegisterDTO();
			associativityRegisterDTO.setRuatId(ruatId);
			associativityRegisterDTO.setStatus("1");
			aSession.getAssociativity().getAssociativityRegisters()
					.add(associativityRegisterDTO);
		}
	}

	public void save() {

	}
}
